from CoTec.utility.string.string_go import StringHelper
from CoTec.core.exception.exception_go import *

class spider:
    @staticmethod
    def get_txt_page_encode(raw:str) -> str:
        try:
            encode = StringHelper.extra_equ_value(raw, 'charset', '"')
            encode = StringHelper.cutfrom(encode, '/')

            encode = encode.replace('"', '')
            encode = encode.replace("'", "")

            return encode
        except HttpConnectionFailedException as e:
            raise e
        except:
            return ''
